#pragma once
#include "sdlcomponent.h"
#include "ScreenMenu.h"
#include "SpriteEasing.h"
#include "StartMenu.h"
#include "SpellList.h"
#include "Boss.h"
#include "WMage.h"
#include "BMage.h"
#include "Warrior.h"
#include "Thief.h"
#include "Magie01.h"
#include "GameOverMenu.h"
#include "GameOver.h"

class FinalFantasy :
	public SDLComponent
{
public:
	FinalFantasy(bool* isGame);
	~FinalFantasy();

	void TitleScreenMenu();
	void InitDialogGame();
	void WriteDialog();

	void FightGame();

	void Start(){}
	void Stop(){}
	void Update();
	void Draw(){}

	void GameStart();
	bool DeathCheck();
	bool VictoryCheck();

	void ClearBattle();

	void Victory();
	void GameOverFunction();

	bool* isPlay;

	enum StateGame{TITLE_SCREEN = 0, MENU_GAME, DIALOG_GAME, FIGHT_GAME, END_GAME, VICTORY};
	enum stateFight{BOSS_RANDOM_ATTACK = 0, CHOIXMENU, INPUT_01, ITEMMENU, INPUT_02, ACTION, SHOW_ENERGY};
	enum indexCharacter{DAVID_INDEX = 0, KEVIN_INDEX, NICOLAS_INDEX, SAMUEL_INDEX, BOSS_INDEX};
	enum indexMenu{ATMAWEAPON_INDEX = 0, CHARACTERMENU_INDEX, SPEAKINGMENU_INDEX, CHOIXMENU_INDEX, ITEMMENU_INDEX};
	enum menuChoix{ATTACK = 0, MAGIC, ITEM, DEFENSE};

private:

	StateGame stateGame;

	StartMenu titleScreen;

	int warriorHP;
	int thiefHP;
	int bMageHP;
	int wMageHP;
	std::string menuText;

	std::string texte1;
	std::string texte2;
	std::string texte3;
	std::string texte4;
	std::string* pTexte;
	int count;
	int texteEnCour;
	int sizeTexte;
	bool canStop;
	float duration;

	Magie01* magieWarrior;
	Magie01* magieThief;
	Magie01* magieBMage;
	Magie01* magieWMage;

	SDLTexte* texteHurt01;
	SDLTexte* texteHurt02;
	SDLTexte* texteHurt03;
	SDLTexte* texteHurt04;
	SDLTexte* texteHurt05;
	SDLTexte* texteHurtBoss;

	SDLSprite* background;
	SDLSprite* victory;

	GameOverMenu* gameOverMenu;
	GameOver* gameOverLetters;

	bool isFirstMenu;
	bool gameOver;

	SpriteEasing* texteHurt01_1;
	SpriteEasing* texteHurt01_2;	

	SpriteEasing* texteHurt02_1;
	SpriteEasing* texteHurt02_2;

	SpriteEasing* texteHurt03_1;
	SpriteEasing* texteHurt03_2;

	SpriteEasing* texteHurt04_1;
	SpriteEasing* texteHurt04_2;

	SpriteEasing* texteHurt05_1;
	SpriteEasing* texteHurt05_2;
	float characterToAttack;

	int bossDamage;
	int bossDamage2;
	int bossDamage3;
	int bossDamage4;
	int currentDamage;

	SDLSprite* bMage;
	SDLSprite* wMage;
	SDLSprite* warrior;
	SDLSprite* thief;

	float currentTime;

	int choix;

	int characterEnCour;
	stateFight etatCombat;

	std::vector<Character*> listeCharacter;
	std::vector<ScreenMenu*> listeMenu;
};

